package com.weixing.mall.provider.model.vo.report.customer;

import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.weixing.mall.base.constant.GlobalConstant;
import com.weixing.mall.provider.model.enums.OrderFromEnum;
import com.weixing.mall.provider.model.enums.OrderStateEnum;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderStatusConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;

/**
 * @author jzy
 * @date 2020/5/15
 */
@Data
@ApiModel(value="CustomerUserReportBuyLogVo", description="客服部-客户报表-查看购买记录")
@ContentRowHeight(40)
public class CustomerUserReportBuyLogVo {
    @ApiModelProperty(value = "用户Id")
    @ExcelIgnore
    private Long buyerId;
    @ApiModelProperty(value = "下单来源 1客服下单，2代理商下单，3客户下单")
    @ExcelIgnore
    private OrderFromEnum orderFrom;
    @ApiModelProperty(value = "sku")
    @ExcelIgnore
    private String skuDesp;
    @ApiModelProperty(value = "商品图片")
    @ExcelIgnore
    private String goodsImg;


    @ExcelProperty("商品图片")
    @ColumnWidth(10)
    private URL goodsImgUrl;

    public void setGoodsImg(String goodsImg) {
        this.goodsImg = goodsImg;
        try {
            if (StrUtil.isNotEmpty(goodsImg)){
                this.goodsImgUrl=new URL(GlobalConstant.IMG_PATH_URL+goodsImg+GlobalConstant.IMG_PATH_URL_SUFFIX);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
    @ApiModelProperty(value = "订单编号")
    @ExcelProperty("订单编号")
    private String orderSn;
    @ApiModelProperty(value = "货号")
    @ExcelProperty("货号")
    private String goodsSn;
    @ApiModelProperty(value = "商品名称")
    @ExcelProperty("商品名称")
    private String goodsName;
    @ApiModelProperty(value = "颜色")
    @ExcelProperty("颜色")
    private String color;
    @ApiModelProperty(value = "尺码")
    @ExcelProperty("尺码")
    private String size;
    @ApiModelProperty(value = "客户姓名")
    @ExcelProperty("客户姓名")
    private String contactUser;
    @ApiModelProperty(value = "手机号")
    @ExcelProperty("手机号")
    private String contactPhone;
    @ApiModelProperty(value = "地址")
    @ExcelProperty("地址")
    private String address;
    @ApiModelProperty(value = "下单人")
    @ExcelProperty("下单人")
    private String buyer;
    @ApiModelProperty(value = "下单人代理")
    @ExcelProperty("下单人代理")
    private String agentName;
    @ApiModelProperty(value = "下单时间")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("下单时间")
    private Date orderCreateTime;
    @ApiModelProperty(value = "客服")
    @ExcelProperty("客服")
    private String customerName;
    @ApiModelProperty(value = "审核时间")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("审核时间")
    private Date auditTime;
    @ApiModelProperty(value = "订单状态（1待付款;4已取消;7已付款/待审核;10,审核中;13;审核完成/待封单;16已封单;19待发货;22已发货;25已完成;28售后中）")
    @ExcelProperty(value = "订单状态",converter = OrderStatusConverter.class)
    private OrderStateEnum orderStatus;

}
